package com.simple.javatraining.testing.Users;

import com.simple.javatraining.testing.io.InputOutput;
import com.simple.javatraining.testing.testinside.answers.Answer;

import java.util.Scanner;

public class User {
    private String userName;

    public User(String userName) {
        this.userName = userName;
    }

    public User(Scanner in) {
        setUserName(in);
    }

    public String getUserName() {
        return userName;
    }

    private void setUserName(Scanner in) {
        InputOutput.outputMessageToConsole("Введите ваше имя");
        userName = in.nextLine();
        if (userName.equals("")) {
            userName = "Anonymous";
        }
    }

    public Answer getAnswer(Scanner in) {
        return new Answer(InputOutput.inputStringAnswer(in));
    }
}
